fix(core): skip default approval for custom MCP tools without usable annotations#16632
fix(core): skip default approval for custom MCP tools without usable annotations#16632fcoury-oai wants to merge 4 commits into
Conversation
37e3e1f to
cd72e5f
Compare
|
I just got this today even though godot mcp was working for me yesterday.
In my config.toml: And codex message:
|
|
@fcoury-oai Any updates on this ticket? |
Yes, we are waiting for a security team member review. I just asked for an update and will let you know once I have a response. |
|
This is affecting me as well, any new updates on timeline @fcoury-oai ? |
|
Same issues here. We will need to wait for checks a suppose... |
…ions Skip the default app-tool approval path for non-`codex_apps` MCP calls when the tool is in `auto` mode and metadata annotations are missing. This restores the expected custom MCP behavior described in `#15824` for both interactive and non-interactive runs, preserves explicit per-tool approval modes such as `prompt` and `approve`, and keeps the regression tests easy to review with small local helpers.
Add the required `/*metadata*/` comments to the positional `None` arguments in the custom MCP approval regression tests. This fixes the argument-comment lint failures on the PR branch without changing test behavior.
Add doc comments to maybe_request_mcp_tool_approval, should_skip_default_custom_mcp_approval, and the non-interactive decline guard to make the early-exit ordering and its rationale explicit. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Treat custom MCP tools with empty `ToolAnnotations` the same as missing annotations when the tool is using the default `auto` approval mode. This avoids routing trivial stdio MCP tools into the approval elicitation path in `exec` mode, which was causing `user cancelled MCP tool call` failures for otherwise safe servers.
0f08e77 to
cc22f36
Compare
|
Closing this pull request because it has had no updates for more than 14 days. If you plan to continue working on it, feel free to reopen or open a new PR. |
|
Please open this up again. this fix is still needed today. i still get e.g. linear write comment tool calls auto rejected... |
Summary
This change restores the expected default behavior for non-
codex_appsMCP tools inautoapproval mode when the server does not provide usable risk annotations.Custom MCP servers may omit
ToolAnnotationsentirely, or they may emit an "empty"ToolAnnotationsobject where every hint isNone. Both cases should behave the same way: Codex should treat the tool as lacking annotation data, not route it into the app-tool approval path.That regression was surfacing in headless
execflows as immediate MCP tool cancellation (user cancelled MCP tool call) for otherwise trivial custom stdio servers.Addresses #15824
Addresses #16685
Behavior
For non-
codex_appsMCP tools in the defaultautoapproval mode:None) also skip the approval path.promptmode still prompts.approvemode still uses the allow/ARC path.codex_appsbehavior is unchanged.Validation
just fmtcargo test -p codex-core --lib mcp_tool_call::tests::custom_auto_mode_skips_approval_when_annotations_are_missing_in_on_request_mode -- --exact --nocapturecargo test -p codex-core --lib mcp_tool_call::tests::custom_auto_mode_skips_approval_when_annotations_have_no_hints_in_on_request_mode -- --exact --nocaptureManual validation with the patched debug binary:
./codex-rs/target/debug/codex exec --json "Use the minimal-regression-repro MCP server and call the ping tool exactly once."./codex-rs/target/debug/codex exec --json --full-auto "Use the minimal-regression-repro MCP server and call the count tool with to=3."Both manual repros completed successfully and returned normal MCP results instead of
user cancelled MCP tool call.Notes
A broader
cargo test -p codex-corerun still hits unrelated existing config test failures around guardian approval defaults on this branch, but the focused MCP regression tests and the manualexecrepro are green.